﻿'----------------------------------------------
'   
'   Kernel Info:---------------------------
'   Developer:              Joshua Teeter
'   Genesis:                09-02-08
'   Last Update:            09-06-30
'   Origional Version:      0.0.0.0
'   Current Version:        0.0.0.4
'   ---------------------------------------
'   
'   
'   If you modify this code please leave your name in the modified by list seperated by a comma. 
'   Changes are to be denoted in the following manner:
'                                                       * New
'                                                       ^ Updated
'                                                       - Removed
'                                                       + Added Functionality
'                                                       ! Bug unresolved
'                                                       / Bug resolved
'                                                       % Modified but not changed in a noticeable way in terms of functionality
'  
'  Please use the following as a template and copy and paste as a new comment for each modification.
'   
'   Modification Info:---------------------
'   Class Name:             SMTWTFS.vb
'   Modified by:            NULL
'   Last Update:            NULL
'   Current Version:        #.#.#.#
'   Changes:                 NULL
'   ---------------------------------------
'   Modification Info:---------------------
'   Class Name:             SMTWTFS.vb
'   Modified by:            Joshua Teeter
'   Last Update:            09-04-23
'   Current Version:        0.0.0.2
'   Changes:                 / Fixed bug with tomorrowTime never giving sunday
'   ---------------------------------------
'   Modification Info:---------------------
'   Class Name:             SMTWTFS.vb
'   Modified by:            Joshua Teeter
'   Last Update:            09-05-05
'   Current Version:        0.0.0.3
'   Changes:                 * Enabled status for each day... see fumctions and setting prefixed with the letter "e"
'                           / Fixed bug that arose when adding enabled status... (typo)
'   ---------------------------------------
'   Modification Info:---------------------
'   Class Name:             SMTWTFS.vb
'   Modified by:            Joshua Teeter
'   Last Update:            09-06-30
'   Current Version:        0.0.0.4
'   Changes:                + Added ability to get string of currently enabled days.
'   ---------------------------------------
'
'

Public Class SMTWTFS

    Private sunday As String
    Private monday As String
    Private tuesday As String
    Private wednesday As String
    Private thursday As String
    Private friday As String
    Private saturday As String

    Private esunday As String
    Private emonday As String
    Private etuesday As String
    Private ewednesday As String
    Private ethursday As String
    Private efriday As String
    Private esaturday As String

    Public Function todaysTime() As String
        Dim i As Integer = Today.DayOfWeek

        If i = 0 Then
            Return sunday
        ElseIf i = 1 Then
            Return monday
        ElseIf i = 2 Then
            Return tuesday
        ElseIf i = 3 Then
            Return wednesday
        ElseIf i = 4 Then
            Return thursday
        ElseIf i = 5 Then
            Return friday
        Else
            Return saturday
        End If

    End Function

    Public Function etodaysTime() As Boolean
        Dim i As Integer = Today.DayOfWeek

        If i = 0 Then
            Return esunday
        ElseIf i = 1 Then
            Return emonday
        ElseIf i = 2 Then
            Return etuesday
        ElseIf i = 3 Then
            Return ewednesday
        ElseIf i = 4 Then
            Return ethursday
        ElseIf i = 5 Then
            Return efriday
        Else
            Return esaturday
        End If

    End Function

    Public Function tomorrowsTime() As String
        Dim i As Integer = Today.DayOfWeek + 1

        If i > 6 Then
            i = 0
        End If

        If i = 0 Then
            Return sunday
        ElseIf i = 1 Then
            Return monday
        ElseIf i = 2 Then
            Return tuesday
        ElseIf i = 3 Then
            Return wednesday
        ElseIf i = 4 Then
            Return thursday
        ElseIf i = 5 Then
            Return friday
        Else
            Return saturday
        End If

    End Function

    Public Function etomorrowsTime() As String
        Dim i As Integer = Today.DayOfWeek + 1

        If i > 6 Then
            i = 0
        End If

        If i = 0 Then
            Return esunday
        ElseIf i = 1 Then
            Return emonday
        ElseIf i = 2 Then
            Return etuesday
        ElseIf i = 3 Then
            Return ewednesday
        ElseIf i = 4 Then
            Return ethursday
        ElseIf i = 5 Then
            Return efriday
        Else
            Return esaturday
        End If

    End Function

    Public ReadOnly Property day(ByVal i As Integer) As String
        Get
            If i = 0 Then
                Return sunday
            ElseIf i = 1 Then
                Return monday
            ElseIf i = 2 Then
                Return tuesday
            ElseIf i = 3 Then
                Return wednesday
            ElseIf i = 4 Then
                Return thursday
            ElseIf i = 5 Then
                Return friday
            Else
                Return saturday
            End If
        End Get
    End Property

    Public ReadOnly Property eday(ByVal i As Integer) As Boolean
        Get
            If i = 0 Then
                Return esunday
            ElseIf i = 1 Then
                Return emonday
            ElseIf i = 2 Then
                Return etuesday
            ElseIf i = 3 Then
                Return ewednesday
            ElseIf i = 4 Then
                Return ethursday
            ElseIf i = 5 Then
                Return efriday
            Else
                Return esaturday
            End If
        End Get
    End Property

    Public Sub setday(ByVal i As Integer, ByVal value As String)
        If i = 0 Then
            sunday = value
        ElseIf i = 1 Then
            monday = value
        ElseIf i = 2 Then
            tuesday = value
        ElseIf i = 3 Then
            wednesday = value
        ElseIf i = 4 Then
            thursday = value
        ElseIf i = 5 Then
            friday = value
        ElseIf i = 6 Then
            saturday = value
        End If
    End Sub

    Public Sub esetday(ByVal i As Integer, ByVal value As Boolean)
        If i = 0 Then
            esunday = value
        ElseIf i = 1 Then
            emonday = value
        ElseIf i = 2 Then
            etuesday = value
        ElseIf i = 3 Then
            ewednesday = value
        ElseIf i = 4 Then
            ethursday = value
        ElseIf i = 5 Then
            efriday = value
        ElseIf i = 6 Then
            esaturday = value
        End If
    End Sub

    Public Function what_days_are_enabled() As String

        Dim output As String = ""

        If esunday Then
            output &= "Sun "
        End If
        If emonday Then
            output &= "Mon "
        End If
        If etuesday Then
            output &= "Tue "
        End If
        If ewednesday Then
            output &= "Wed "
        End If
        If ethursday Then
            output &= "Thu "
        End If
        If efriday Then
            output &= "Fri "
        End If
        If esaturday Then
            output &= "Sat "
        End If

        Return output

        System.GC.Collect()
    End Function

    Public Sub New(ByVal sun As String, ByVal mon As String, ByVal tue As String, ByVal wed As String, _
                   ByVal thu As String, ByVal fri As String, ByVal sat As String, _
                   ByVal esun As Boolean, ByVal emon As Boolean, ByVal etue As Boolean, ByVal ewed As Boolean, _
                   ByVal ethu As Boolean, ByVal efri As Boolean, ByVal esat As Boolean)

        sunday = sun
        monday = mon
        tuesday = tue
        wednesday = wed
        thursday = thu
        friday = fri
        saturday = sat

        esunday = esun
        emonday = emon
        etuesday = etue
        ewednesday = ewed
        ethursday = ethu
        efriday = efri
        esaturday = esat

    End Sub

    Public Sub New()

        sunday = "00:10:01"
        monday = "00:10:01"
        tuesday = "00:10:01"
        wednesday = "00:10:01"
        thursday = "00:10:01"
        friday = "00:10:01"
        saturday = "00:10:01"

        esunday = True
        emonday = True
        etuesday = True
        ewednesday = True
        ethursday = True
        efriday = True
        esaturday = True

    End Sub

    Public Overrides Function ToString() As String
        Return sunday & "," & esunday & _
        "|" & monday & "," & emonday & _
        "|" & tuesday & "," & etuesday & _
        "|" & wednesday & "," & ewednesday & _
        "|" & thursday & "," & ethursday & _
        "|" & friday & "," & efriday & _
        "|" & saturday & "," & esaturday
    End Function



End Class
